home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / git-4.3 / git-4 / git-4.3.7 / src / panel.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-08  |  8.2 KB  |  236 lines

  1. /* panel.h -- the data structures and function prototypes used in panel.c. */
  2.  
  3. /* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 2, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* Written by Tudor Hulubei and Andrei Pitis.  */
  20.  
  21.  
  22. #ifndef _GIT_PANEL_H
  23. #define _GIT_PANEL_H
  24.  
  25.  
  26. #include <sys/types.h>
  27. #include <limits.h>
  28. #include <stddef.h>
  29.  
  30.  
  31. #ifdef HAVE_UNISTD_H
  32. #include <unistd.h>
  33. #endif
  34.           
  35. #if HAVE_DIRENT_H
  36. #include <dirent.h>
  37. #define NAMLEN(dirent) strlen((dirent)->d_name)
  38. #else /* !HAVE_DIRENT_H */
  39. #define dirent direct
  40. #define NAMLEN(dirent) (dirent)->d_namlen
  41. #ifdef HAVE_SYS_NDIR_H
  42. #include <sys/ndir.h>
  43. #endif /* HAVE_SYS_NDIR_H */
  44. #ifdef HAVE_SYS_DIR_H
  45. #include <sys/dir.h>
  46. #endif /* HAVE_SYS_DIR_H */
  47. #ifdef HAVE_NDIR_H
  48. #include <ndir.h>
  49. #endif /* HAVE_NDIR_H */
  50. #endif /* !HAVE_DIRENT_H */
  51.  
  52. #include "stdc.h"
  53. #include "xstack.h"
  54.  
  55.  
  56. /* Panel actions.  */
  57. #define act_NOACTION                     0
  58. #define act_ENTER                        1
  59. #define act_COPY                         2
  60. #define act_DELETE                       3
  61. #define act_SELECT                       4
  62. #define act_SELECT_ALL                   5
  63. #define act_UNSELECT_ALL                 6
  64. #define act_TOGGLE                       7
  65.  
  66. #define act_DISPLAY_NEXT_MODE            8
  67. #define act_DISPLAY_OWNER_GROUP          9
  68. #define act_DISPLAY_DATE_TIME           10
  69. #define act_DISPLAY_SIZE                11
  70. #define act_DISPLAY_MODE                12
  71. #define act_DISPLAY_FULL_NAME           13
  72. #define act_DISPLAY_ALL                 14
  73.  
  74. #define act_SORT_NEXT_METHOD            15
  75. #define act_SORT_BY_NAME                16
  76. #define act_SORT_BY_EXTENSION           17
  77. #define act_SORT_BY_SIZE                18
  78. #define act_SORT_BY_DATE                19
  79. #define act_SORT_BY_MODE                20
  80. #define act_SORT_BY_OWNER_ID            21
  81. #define act_SORT_BY_GROUP_ID            22
  82. #define act_SORT_BY_OWNER_NAME          23
  83. #define act_SORT_BY_GROUP_NAME          24
  84.  
  85. #define act_MKDIR                       25
  86. #define act_MOVE                        26
  87. #define act_UP                          27
  88. #define act_DOWN                        28
  89. #define act_PGUP                        29
  90. #define act_PGDOWN                      30
  91. #define act_HOME                        31
  92. #define act_END                         32
  93. #define act_CHDIR                       33
  94. #define act_REFRESH                     34
  95. #define act_SWITCH                      35
  96.  
  97. #define act_PATTERN_SELECT              36
  98. #define act_PATTERN_UNSELECT            37
  99.  
  100. #define act_SET_SCROLL_STEP             38
  101.  
  102. #define act_ISEARCH_BEGIN               39
  103. #define act_ISEARCH_BACKWARD            40
  104. #define act_ISEARCH_FORWARD             41
  105. #define act_ISEARCH_END                 42
  106.  
  107.  
  108. /* File sort methods.  */
  109. #define SORT_BY_NAME                     0
  110. #define SORT_BY_EXTENSION                1
  111. #define SORT_BY_SIZE                     2
  112. #define SORT_BY_DATE                     3
  113. #define SORT_BY_MODE                     4
  114. #define SORT_BY_OWNER_ID                 5
  115. #define SORT_BY_GROUP_ID                 6
  116. #define SORT_BY_OWNER_NAME               7
  117. #define SORT_BY_GROUP_NAME               8
  118.  
  119.  
  120. /* File display modes.  */
  121. #define DISPLAY_OWNER_GROUP              0
  122. #define DISPLAY_DATE_TIME                1
  123. #define DISPLAY_SIZE                     2
  124. #define DISPLAY_MODE                     3
  125. #define DISPLAY_FULL_NAME                4
  126. #define DISPLAY_ALL                      5
  127.  
  128.  
  129. /* File types.  */
  130. #define DIR_ENTRY                        0
  131. #define FILE_ENTRY                       1
  132. #define SYMLINK_ENTRY                    2
  133. #define FIFO_ENTRY                       3
  134. #define SOCKET_ENTRY                     4
  135.  
  136.  
  137. #define ACTIVE_PANEL_MARKER             '>'
  138. #define INACTIVE_PANEL_MARKER           '*'
  139.  
  140.  
  141. /* Internal structure, used by the push/pop functions to keep track of
  142.    isearched entries.  */
  143. typedef struct
  144. {
  145.     int entry;          /* the panel entry number.  */
  146.     size_t length;      /* isearch_length at match time.  See below.  */
  147. } isearch_t;
  148.  
  149.  
  150. /* Structure used to pass isearch-specific parameters to panel_action.  */
  151. typedef struct
  152. {
  153.     int action;         /* the action to be performed.  */
  154.     char *string;       /* the current isearched string.  */
  155.     size_t length;      /* the new length of the isearched string.  */
  156. } isearch_aux_t;
  157.  
  158.  
  159. typedef struct
  160. {
  161.     char         *name;
  162.     size_t        size;
  163.     mode_t        mode;
  164.     uid_t         uid;
  165.     gid_t         gid;
  166.     time_t        mtime;
  167.     char         *owner;
  168.     char         *group;
  169.     char          date[16];
  170.     unsigned      selected   : 1,
  171.                   type       : 4,
  172.                   executable : 1;
  173. } dir_entry_t;
  174.  
  175.  
  176. typedef struct
  177. {
  178.     DIR *dir;                   /* the current directory.  */
  179.     window_t *window;           /* the panel window.  */
  180. #ifdef HAVE_LINUX
  181.     int msdosfs;                /* the current panel directory resides
  182.                                    on a MSDOG direrctory.  Argh...  */
  183. #endif  /* HAVE_LINUX */
  184.     int on_screen;              /* # of files on the screen.  */
  185.     char *path;                 /* the current path.  */
  186.     char *temp;                 /* a temporary string.  */
  187.     int current_entry;          /* the current file entry #.  */
  188.     int first_on_screen;        /* the # of the entry displayed in the
  189.                                    panel's first line.  */
  190.     size_t maxname;             /* don't bother :-) */
  191.     dir_entry_t *dir_entry;     /* a record for each file in the
  192.                                    current directory.  */
  193.     size_t isearch_length;      /* the current length of the string
  194.                                    used in incremental search.  */
  195.     xstack_t *isearch_stack;    /* the isearch stack.  */
  196.     int last_index;             /* used in the iterator.  */
  197.     int multiple_files;         /* a flag used in the iterator.  */
  198.     int lines, columns;         /* the panel is that big.  */
  199.     int x, y;                   /* the panel's position.  */
  200.     int entries;                /* the # of files/directories.  */
  201.     char focus;                 /* the panel's focus flag.  */
  202.     char visible;               /* the panel's visible flag.  */
  203.     char wrapped_isearch;       /* the wrapped isearch_flag.  */
  204.     size_t selected_files;      /* the # of selected files.  */
  205.     size_t pathlen;             /* the path length.  */
  206.     int display_mode;           /* the current display mode.  */
  207.     int sort_method;            /* the current sort method.  */
  208.     int scroll_step;            /* the scroll step.  */
  209.     int chkdest;                /* don't bother :-) */
  210. } panel_t;
  211.  
  212.  
  213. extern panel_t *panel_init __P((int, int, int, int, char *));
  214. extern void     panel_end __P((panel_t *));
  215. extern void     panel_init_iterator __P((panel_t *));
  216. extern void     panel_select_all __P((panel_t *));
  217. extern void     panel_unselect_all __P((panel_t *));
  218. extern int      panel_get_next __P((panel_t *));
  219. extern void     panel_set_focus __P((panel_t *, int));
  220. extern void     panel_no_optimizations __P((panel_t *));
  221. extern int      panel_action __P((panel_t *, int, panel_t *, void *, int));
  222. extern char    *panel_get_path __P((panel_t *));
  223. extern char    *panel_get_current_file_name __P((panel_t *));
  224. extern uid_t    panel_get_current_file_uid __P((panel_t *));
  225. extern gid_t    panel_get_current_file_gid __P((panel_t *));
  226. extern mode_t   panel_get_current_file_mode __P((panel_t *));
  227. extern int      panel_get_current_file_type __P((panel_t *));
  228. extern void     panel_resize __P((panel_t *, int, int, int, int));
  229. extern void     panel_activate __P((panel_t *));
  230. extern void     panel_deactivate __P((panel_t *));
  231. extern void     panel_update __P((panel_t *));
  232. extern void     panel_set_wrapped_isearch_flag __P((panel_t *));
  233.  
  234.  
  235. #endif  /* _GIT_PANEL_H */
  236.